<?xml version="1.0" encoding="UTF-8" ?>
<!-- jsf:pagecode language="java" location="/src/pagecode/Tecajnice.java" --><!-- /jsf:pagecode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<ui:composition template="layout/pageLayout.xhtml">

	<ui:define name="content">

		<p:growl id="growl" showDetail="true" life="5000" />
		<p:fieldset legend="Parametri iskanja" toggleable="true"
			toggleSpeed="500">
			<h:form id="VnosParamtrov">
				<p:panelGrid>
					<p:row>
						<p:column>
							<h:outputLabel value="Izberi vrsto tečajnice: "
								for="izbiraVrsteTecajnice" />
						</p:column>
						<p:column>
							<p:selectOneMenu id="izbiraVrsteTecajnice"
								value="#{urejanjeTecajev.sifraIzbraneVrstaTecajnice}"
								effect="fade" required="true">
								<f:selectItems value="#{urejanjeTecajev.seznamVrstTecajnic}"
									var="vrstaTecajnice"
									itemValue="#{vrstaTecajnice.sifraVrsteTecajnice}"
									itemLabel="#{vrstaTecajnice.nazivVrsteTecajnice}" />
							</p:selectOneMenu>
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputLabel value="Izberi valuto: " for="izbiraValute" />
						</p:column>
						<p:column>
							<p:selectOneMenu id="izbiraValute"
								value="#{urejanjeTecajev.sifraIzbraneValute}" effect="fade"
								required="true">
								<f:selectItems value="#{urejanjeTecajev.vseValute}" var="valuta"
									itemValue="#{valuta.sifraValute}"
									itemLabel="#{valuta.oznakaValute}" />
							</p:selectOneMenu>
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputLabel value="Izberi datum: " for="izbiraDatuma" />
						</p:column>
						<p:column>
							<p:calendar id="izbiraDatuma"
								value="#{urejanjeTecajev.izbranDatum}" navigator="true"
								display="inline" required="true">
							</p:calendar>
						</p:column>
					</p:row>
					<p:row>
						<p:column colspan="2">
							<h:commandButton value="Prikazi tecaj za urejanje"
								action="#{urejanjeTecajev.prikaziTecaj}"
								update="testPrikazTecaja" />
						</p:column>
					</p:row>
				</p:panelGrid>
			</h:form>
		</p:fieldset>
	<br />
		<c:if id="testPrikazTecaja" test="#{urejanjeTecajev.tecajIzbran}">
			<p:fieldset legend="Izbran tecaj">
				<h:form>
					<p:panelGrid>
						<p:row>
							<p:column>
								<h:outputLabel value="Datum tecaja: " for="datum" />
							</p:column>
							<p:column>
								<h:outputText id="datum"
									value="#{urejanjeTecajev.izbranTecaj.id.datumTecajnice}" />

							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputLabel value="Vrsta tecajnice: " for="vrstaTecajnice" />
							</p:column>
							<p:column>
								<h:outputText id="vrstaTecajnice"
									value="#{urejanjeTecajev.izbranTecaj.tecajnica.vrstaTecajnice.nazivVrsteTecajnice}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputLabel value="Valuta: " for="valuta" />
							</p:column>
							<p:column>
								<h:outputText id="valuta"
									value="#{urejanjeTecajev.izbranTecaj.valuta.oznakaValute}" />
							</p:column>
						</p:row>
						
						<c:if test="#{urejanjeTecajev.srednjiTecajSet}">
							<p:row>
								<p:column>
									<h:outputLabel value="Srednji tecaj: " for="srednji" />
								</p:column>
								<p:column>
									<p:inplace editor="true">
										<p:ajax event="save" listener="#{urejanjeTecajev.handleSave}" />
										<h:inputText value="#{urejanjeTecajev.srednjiTecaj}" />
									</p:inplace>

								</p:column>
							</p:row>
						</c:if>
						<c:if test="#{urejanjeTecajev.nakupniTecajSet}">
							<p:row>
								<p:column>
									<h:outputLabel value="Nakupni tecaj: " for="nakupni" />
								</p:column>
								<p:column>
									<p:inplace editor="true">
										<p:ajax event="save" listener="#{urejanjeTecajev.handleSave}" />
										<h:inputText value="#{urejanjeTecajev.nakupniTecaj}" />
									</p:inplace>

								</p:column>
							</p:row>
						</c:if>
						<c:if test="#{urejanjeTecajev.prodajniTecajSet}">
							<p:row>
								<p:column>
									<h:outputLabel value="Prodajni tecaj: " for="prodajni" />
								</p:column>
								<p:column>
									<p:inplace editor="true">
										<p:ajax event="save" listener="#{urejanjeTecajev.handleSave}" />
										<h:inputText value="#{urejanjeTecajev.prodajniTecaj}" />
									</p:inplace>

								</p:column>
							</p:row>
						</c:if>

					</p:panelGrid>
				</h:form>
			</p:fieldset>
		</c:if>

	</ui:define>
</ui:composition>
</html>